var o = require("./UIPopupBase.js"), i = require("../UIManager/UISoundManager.js");
cc.Class({
    extends: o,
    properties: {
        btns: {
            default: null,
            type: cc.Node
        },
        labelText: {
            default: null,
            type: cc.Label
        },
        nodeChoseShare: cc.Node
    },
    onLoad: function () {
        this.isChoseShare = !0, this.bShowAward = !0, this.initView(), this.grims = this.btns.children,
            this.inviteLimit = this.grims.length, this.onPulled_InviteFriendDate(), this.contentText = "好友点转运卡片也可得3000金币,仅限前3名",
            this.labelText.string = this.contentText, this.clickNum = !1;
    },
    onPulled_InviteFriendDate: function (e) {
        this.inviteReward = 3e3, this.currentIndex = 3, this.headUrlArr = 0, this.setDate();
    },
    setDate: function () {
        for (var e = 0; e < this.grims.length; e++) {
            Global.utils.searchNode(this.grims[e], "nodeHead").active = !1, this.setNodeReceiveActive({});
        }
    },
    setNodeReceiveActive: function (e) {
        e.parent, e.active;
    },
    onStartGame: function (e) {
        e = e || Global.roomInfoModel.getRecommendRoomId();
        Global.roomInfoModel.setRoomId(e);
        var t = Global.roomInfoModel.getPlayModel();
        t && Global.msgHandler.requestQuickStart(t, e);
    },
    onPulled_PrizeDate: function (e) {
        if (cc.log("+++++++++++++领取奖励+++++++++++++++", e), e.error) {
            if (console.log("onPulled_AllPrizeData error code:", e.error, e.error.code), -1e3 == e.error.code) {
                var t = {
                    text: e.error.info,
                    confirmText: "确定",
                    confirmSp: Global.spriteAtlas.getOKSpf()
                };
                Global.UIPopupManager.alert(t), this.bShowAward = !1, this.onStartGame();
            }
        } else 1 == e.operateOk && (this.bShowAward = !0);
    },
    onPullData: function (e) {
        this.data = e, leftTime = 3, this.initView();
    },
    initView: function () {
    },
    start: function () {
    },
    getReward: function () {
        console.warn("getReward3000", 3e3), console.warn("Global.bGetRedPacket", Global.bGetRedPacket);
    },
    onClickFunChoseShare: function () {
        this.isChoseShare = !this.isChoseShare, cc.log("onClickFunChoseShare", this.nodeChoseShare.active);
    },
    onClickInviteFri: function () {
        if (console.log("onClickReward"), !this.clickNum) {
            this.clickNum = !0, i.playEffect("select");
            var e = Global.eventName.CMD_REQUEST_REDPACKET, t = Global.userProfile.getUserId() + "|",
                n = cc.sys.now() + "|", o = Global.utils.randomInt(1, 99999) + "";
            cc.log("userId", t), cc.log("time", n), cc.log("randnum", o);
            var a = t + n + o, r = Global.userProfile.getUserName();
            tywx.UserInfo.isiPhone;
            if (this.isChoseShare) {
                var s = this, l = (t = Global.userProfile.getUserId(), {
                    getRedPacket: 5,
                    redPackId: a,
                    helpName: r
                }), c = JSON.stringify(l);
                Global.config.sharePointId.RedPacket;
                Global.utils_Share.shareToGroup(Global.config.sharePointId.RedPacket, function (t) {
                    Global.msgHandler.requestSkipLuckRedPacket(e, a, 0), s.closePanel(), console.log("分享成功");
                }, function (e) {
                    s.clickNum = !1, console.log("分享失败");
                }, c);
            } else {
                Global.msgHandler.requestSkipLuckRedPacket(e, a, 0), (s = this).closePanel();
            }
        }
    },
    getBoolChoseShare: function () {
        return this.isChoseShare;
    },
    OnPanelClose: function () {
        if (i.playEffect("select"), Global.tableModel.isInGameScene() && !Global.tableModel.getIsGameEnd()) {
            console.log("手动关闭弹框，默认不充值+++++++++++");
            var e = Global.tableModel.getPlayerModel(Global.config.SEAT_DOWN);
            e && Global.tableModel.requestCharge(-1, e.getSeatId());
        }
        this.closePanel();
    },
    onDestroy: function () {
        console.error("  转运红包礼包被干掉了啊，大家快去看啊");
    }
})
